package org.edu.prj.langton.lefebvre.impl;

import org.edu.prj.langton.lefebvre.calcul.Logique;
import org.edu.prj.langton.LangtonEngine;
import org.edu.prj.langton.utils.LMatrix;

public class Fourmi implements LangtonEngine{
	
	private LMatrix m_lMatrix;
	private int m_x;
	private int m_y;
//	private int m_degre;
	private String m_nom;
	private Direction m_direction;
	public Fourmi(String nom, Direction direction) {
		m_nom = nom;
		m_x = 0;
		m_y = 0;
//		m_degre = 0;
		m_direction = direction;
	
	}
	
    public enum Direction {
        NORD, SUD, EST, OUEST
    }

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return m_nom;
	}

	@Override
	public LMatrix getState() {
		// TODO Auto-generated method stub
		return m_lMatrix;
	}

	@Override
	public void initialise(int arg0, int arg1) {
		// TODO Auto-generated method stub
		m_lMatrix = new LMatrix(arg0, arg1);
		
	}

	@Override
	public void nextGeneration() {
		// TODO Auto-generated method stub
		Logique.move(this);
	} 

	@Override
	public void startAt(int arg0, int arg1) {
		// TODO Auto-generated method stub
		//set the fourmi position
		m_x = arg0;
		m_y = arg1;
		//active the cell of the matrix
		m_lMatrix.activateCell(arg0, arg1);

	}

	public int getM_x() {
		return m_x;
	}

	public void setM_x(int m_x) {
		this.m_x = m_x;
	}

	public int getM_y() {
		return m_y;
	}

	public void setM_y(int m_y) {
		this.m_y = m_y;
	}

	public Direction getM_direction() {
		return m_direction;
	}

	public void setM_direction(Direction m_direction) {
		this.m_direction = m_direction;
	}

	public LMatrix getM_lMatrix() {
		return m_lMatrix;
	}

	public void setM_lMatrix(LMatrix m_lMatrix) {
		this.m_lMatrix = m_lMatrix;
	}
	
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return "x = " + this.getM_x() + "\ny = " + this.getM_y() + "\nDirection : " + this.getM_direction();
	}
}
